<?php

$uploaddir = './uploads/' . $_POST['directory'] . '/';
$file = $uploaddir . basename($_FILES['uploadfile']['name']);

if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {
    echo "sucess";
} else {
    echo "error";
}
?>